<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see UserController
 */
class UserController extends BaseController
{

    /**
     * avatar
     * @uri /user/avatar
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"7DFF4E754C4E2451","file":"481D355834D2C764"}
     * @response {"success":true,"statusCode":200,"result":{"url":"1.jpg"},"message":"OK"}
     */
    public function avatar(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"url":"1.jpg"},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * changePhone
     * @uri /user/change-phone
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"prev_code":"EA1B0AB0552A93C2","code":"56D6D7302B2F8214","phone":"20D124E504DD8678"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function changePhone(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * dynamicList
     * @uri /user/dynamic-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"last_id":"F8F6273053BC5BAF"}
     * @response {"success":true,"statusCode":200,"result":{"total_count":1,"page_size":20,"page":1,"list":[{"id":"24\u4f4d\u52a8\u6001ID","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_fail":false,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_fail":false}}}]},"message":"OK"}
     */
    public function dynamicList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"total_count":1,"page_size":20,"page":1,"list":[{"id":"24\u4f4d\u52a8\u6001ID","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_fail":false,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_fail":false}}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * edit
     * @uri /user/edit
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"6CCADC19F36EB0DD","nickname":"B012BE92FCED1C67","sign":"9A0B6AF0ED880610","gender":"2CC31705DE53016C","birthday":"3D4EFEA6A7B22188","country":"148AF674A36DE931","province":"C7752877C9D7555B","city":"2B8BC0B7FD659B22","industry":"104C35B754E7D527","education":"3C6CCB84006296CE","job":"6F128BCED70E4044"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function edit(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * getDetail
     * @uri /user/get-detail
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"54919627F2A0816E"}
     * @response {"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u6635\u79f0","avatar":"\u5c01\u9762\u56fe","identity":2,"phone":"\u624b\u673a\u53f7\uff0c\u6ce8\u610f\u9690\u85cf\u4e2d\u95f44\u4f4d","is_fail":"\u662f\u5426\u5f02\u5e38\uff0c0\u5426\uff0c1\u662f","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173","wechat":{"nickname":"\u5fae\u4fe1\u6635\u79f0"},"created_at":1579197762,"gender":"\u6027\u522b\uff0c1\u7537\uff0c2\u5973\uff0c3\u4fdd\u5bc6","birthday":0,"sign":"\u4e2a\u6027\u7b7e\u540d","education":"\u5b66\u5386","industry":"\u884c\u4e1a","job":"\u804c\u4e1a","count":{"note":1,"dynamic":1}},"message":"OK"}
     */
    public function getDetail(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u6635\u79f0","avatar":"\u5c01\u9762\u56fe","identity":2,"phone":"\u624b\u673a\u53f7\uff0c\u6ce8\u610f\u9690\u85cf\u4e2d\u95f44\u4f4d","is_fail":"\u662f\u5426\u5f02\u5e38\uff0c0\u5426\uff0c1\u662f","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173","wechat":{"nickname":"\u5fae\u4fe1\u6635\u79f0"},"created_at":1579197762,"gender":"\u6027\u522b\uff0c1\u7537\uff0c2\u5973\uff0c3\u4fdd\u5bc6","birthday":0,"sign":"\u4e2a\u6027\u7b7e\u540d","education":"\u5b66\u5386","industry":"\u884c\u4e1a","job":"\u804c\u4e1a","count":{"note":1,"dynamic":1}},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * getInfo
     * @uri /user/get-info
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request []
     * @response {"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u6635\u79f0","avatar":"\u5c01\u9762\u56fe","is_fail":"\u662f\u5426\u5f02\u5e38\uff0c0\u5426\uff0c1\u662f","created_at":1579197762,"count":{"note":1,"dynamic":1}},"message":"OK"}
     */
    public function getInfo(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u6635\u79f0","avatar":"\u5c01\u9762\u56fe","is_fail":"\u662f\u5426\u5f02\u5e38\uff0c0\u5426\uff0c1\u662f","created_at":1579197762,"count":{"note":1,"dynamic":1}},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * likeList
     * @uri /user/like-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"EA4A980F5707E66D"}
     * @response {"success":true,"statusCode":200,"result":{"total_count":1,"page_size":20,"page":1,"list":[{"id":"","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_fail":false,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_fail":false}}}]},"message":"OK"}
     */
    public function likeList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"total_count":1,"page_size":20,"page":1,"list":[{"id":"","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_fail":false,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_fail":false}}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * noteList
     * @uri /user/note-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"F5132FD135DE38AE","last_id":"9273F791E3CDA4BE"}
     * @response {"success":true,"statusCode":200,"result":{"have_more":40,"list":[{"id":"24\u4f4d\u6587\u7ae0ID","content":"\u7b14\u8bb0\u5185\u5bb9","selected":"\u6587\u7ae0\u8282\u9009","start_index":3,"end_index":5,"is_fail":0,"is_public":2,"is_collect":false,"is_like":false,"created_at":1592910533,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"collect":1,"like":0,"comment":0},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe","description":"\u6587\u7ae0\u6458\u8981"}}]},"message":"OK"}
     */
    public function noteList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"have_more":40,"list":[{"id":"24\u4f4d\u6587\u7ae0ID","content":"\u7b14\u8bb0\u5185\u5bb9","selected":"\u6587\u7ae0\u8282\u9009","start_index":3,"end_index":5,"is_fail":0,"is_public":2,"is_collect":false,"is_like":false,"created_at":1592910533,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"collect":1,"like":0,"comment":0},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe","description":"\u6587\u7ae0\u6458\u8981"}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * packageList
     * @uri /user/package-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"last_id":"8010A0340D5FFF28"}
     * @response {"success":true,"statusCode":200,"result":{"have_more":true,"list":[{"id":"24\u4f4d\u6536\u85cf\u5939ID","name":"\u540d\u79f0","description":"\u6458\u8981","total":"\u5185\u5bb9\u6570","is_public":2,"is_default":2,"is_deleted":"\u662f\u5426\u5220\u9664\uff0c0\u6b63\u5e38\uff0c1\u5220\u9664","updated_at":1597200251}]},"message":"OK"}
     */
    public function packageList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"have_more":true,"list":[{"id":"24\u4f4d\u6536\u85cf\u5939ID","name":"\u540d\u79f0","description":"\u6458\u8981","total":"\u5185\u5bb9\u6570","is_public":2,"is_default":2,"is_deleted":"\u662f\u5426\u5220\u9664\uff0c0\u6b63\u5e38\uff0c1\u5220\u9664","updated_at":1597200251}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * rePwd
     * @uri /user/re-pwd
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"code":"2C8F4683C94168DF","pwd":"5F65C19BA138E968","confirm_pwd":"500F998EE22A0717"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function rePwd(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}